{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'plugins/bootstrap-3.4.1-dist/bootstrap-3.4.1-dist/css/bootstrap.min.css' %}">
</head>
<body>
<nav class="navbar navbar-default">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">用户管理系统</a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav nav-li">
        <li class="active"><a href="/depart/list/">部门管理 <span class="sr-only">(current)</span></a></li>
        <li><a href="/admin/list/"> 用户员管理 </a></li>
        <li><a href="/user/list/"> 用户管理 </a></li>
        <li><a href="/phone/list/">靓号管理</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ request.session.info.name }} <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">个人资料</a></li>
            <li><a href="#">我的信息</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="/loginout/">注销</a></li>
          </ul>
        </li>
      </ul>
    </div>
  </div>
</nav>

<div>
    {% block conmet %}
    {% endblock %}
</div>
    <script>
        // 获取导航列表
    const navList = document.querySelector('nav-li');
    // 获取所有列表项
    const navItems = navList.querySelectorAll('li');

    // 为每个列表项添加点击事件
    for (let i = 0; i < navItems.length; i++) {
        navItems[i].addEventListener('click', function(event) {
            // 移除所有列表项的 active 类
            for (let j = 0; j < navItems.length; j++) {
                navItems[j].classList.remove('active');
            }
            // 给当前点击的列表项添加 active 类
            this.classList.add('active');
            // 阻止链接的默认行为，防止页面跳转
            event.preventDefault();
        });
    }
    </script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>

    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</body>
</html>